package cn.edu.xmu.oomall.customer.mapper;


import cn.edu.xmu.oomall.customer.mapper.po.CouponPo;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CouponPoMapper extends JpaRepository<CouponPo,Long> {

    @Query("select c from CouponPo c where c.customerId = :customerId and c.activityId = :actId")
    List<CouponPo> retrieveCouponByCustomerIdAndActId(Long customerId, Long actId);

    @Query("select count(*)  from CouponPo c")
    Long findCountById();

    List<CouponPo> findByCustomerId(Long id, Pageable pageable);
}
